package com.ylq.todolsitserver.controller;

import com.ylq.todolsitserver.service.StatsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/api/stats")
public class StatsController {

    @Autowired
    private StatsService statsService;

    /**
     * 获取任务总数
     * @return
     */
    @GetMapping
    public ResponseEntity<Map<String, Integer>> getTaskStats() {
        log.info("获取所有状态");
        return ResponseEntity.ok(statsService.getTaskStats());
    }
}
